1. Field of the Invention
The present invention relates to a coding apparatus, a coding method and a coding program for controlling the coding rate of an image sequence and also to a recording medium storing such a program.
2. Description of the Related Art
Known rate control techniques that can be used for encoding an image sequence according to a bit plane coding system include rate control that utilizes truncation of cutting off the coding path so as to achieve a target bit rate after coding and multi-loop rate control of controlling the coding rate only by means of the quantization step size given before coding.
The former technique has a short processing time because it is possible to accurately control the coding rate by a single coding operation. On the other hand, since a constant coding rate is assigned to frames, the image quality can vary significantly from frame to frame to consequently degrade the image quality as a whole particularly when the degree of coding facility varies among frames. The latter technique has a small dispersion and a good image quality because a high coding rate is assigned to frames showing a low degree of coding facility while a low coding rate is assigned to frames showing a high degree of coding facility. On the other hand, since it is not possible to know the relationship between the quantization step size and the generated bit rate before coding and hence it is necessary to search for an optimal quantization step size by repeatedly coding all the frames in order to accurately control the coding rate. In short, this technique involves a time consuming process.
While the two techniques have respective advantages and disadvantages, the multi-loop rate control technique is preferable when non-linearly pursuing a high image quality as in the case of digital cinema.
Meanwhile, binary search (binary tree search) is a popular technique for searching for an optimal quantization step size for multi-loop plate control (see Patent Document 1: Jpn. Pat. Appln. Laid-Open Publication No. H. 10-191343). Binary search involves the use of an algorithm for searching for a target value from sorted data. With binary search, the range of search is divided into two at an intermediate point to see which one includes the target value and the range of search that includes the target value is divided into two at an intermediate point. This process is repeated until the target value is located. The quantization step size and the generated bit rate show such a relationship that the generated bit rate falls as the quantization step size increases so that the target value can be regarded as sorted data and hence the technique of binary search can feasibly be employed.
FIG. 1 of the accompanying drawings shows a flowchart of the sequence for searching for an optimal quantization step size by means of binary search. Note that the largest value and the smallest value of the range of search of the quantization step size are respectively expressed by Δmax and Δmin whereas the generated bit rate when the quantization step size is A and the target bit rate are respectively R (Δ) and R and the threshold value to be used for determining to cut off the loop is Th.
Referring to FIG. 1, firstly in Step S21, the average value of the largest value Δmax and the smallest value Δmin of the range of search is defined as quantization step size Δ. In Step S22, all the frames of the image sequence are coded with the quantization step size Δ to determine the generated bit rate R (Δ).
Then, in Step S23, it is determined if the absolute value of the difference between the target bit rate R and the generated bit rate R (Δ) is less than the threshold value Th or not and, if it is not less than the threshold value Th, it is determined in Step S24 if the target bit rate R is less than the generated bit rate R (Δ) or not. Δ is set as Δmin in Step S25 when the target bit rate R is less than the generated bit rate R (Δ) and the processing operation returns to Step S21, whereas Δ is set as Δmax when the target bit rate R is more than the generated bit rate R (Δ) and the processing operation returns to Step S21.
On the other hand, the process simply ends if it is determined in Step S23 that the absolute value of the difference between the target bit rate R and the generated bit rate R (Δ) is less than the threshold value Th.